package com.cq.androidtools.text

import android.util.Log
import android.view.View
import com.cq.androidtools.databinding.AcTextBinding
import com.cq.base.activity.BaseViewBindingActivity

/**
 * 作者: CQ
 * 日期: 2022-07-12
 * 说明:
 */
class TextViewActivity : BaseViewBindingActivity<AcTextBinding>() {
    override fun initView() {
        super.initView()

//        val outSize = Point()
//        windowManager.defaultDisplay.getRealSize(outSize)
//
//        val height = resources.displayMetrics.heightPixels
//
//        Log.e("mBinding.text", "width = ${outSize.y}, height = ${outSize.x}")
//        Log.e("mBinding.text", "width = ${ resources.displayMetrics.widthPixels}, height = ${ resources.displayMetrics.heightPixels}")
//
//        val resourceId: Int = resources.getIdentifier("status_bar_height", "dimen", "android")
//        val statusBarHeight: Int = resources.getDimensionPixelSize(resourceId)
//
//        val resourceId1: Int = resources.getIdentifier("navigation_bar_height", "dimen", "android")
//        val statusBarHeight1: Int = resources.getDimensionPixelSize(resourceId1)
//
//
//        Log.e("text", "View绘制区域高度：${statusBarHeight}")
//        Log.e("text", "View绘制区域高度：${statusBarHeight1}")
//        Log.e("text", "View绘制区域高度：${height - statusBarHeight1-statusBarHeight}")
//
//
//        mBinding.text.text = getDataXS()
//        mBinding.text.post {
//            Log.e("text", "height = " + mBinding.text.height.toString())
//            Log.e("text", "width = " + mBinding.text.width.toString())
//        }

    }

    private fun onShowH(){
        val w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)

        val h = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED)

        mBinding.text.measure(w, h)

        val height =mBinding.text.measuredHeight

        val width =mBinding.text.measuredWidth
        Log.e("mBinding.text", "width = $width, height = $height")

    }

}